﻿using DiffuseEnjoyIdle.MessageCenter.RabbitMQ;
using Microsoft.Extensions.DependencyInjection;

namespace DiffuseEnjoyIdle.Extension.Extensions
{
    public static class MQInstaller
    {
        public static IServiceCollection AddMQHandler(this IServiceCollection services)
        {

            services.AddSingleton(o => o.GetServices<IMQHandler>().ToArray());

            services.AddSingleton(o => RabbitMQKeyName.Tuples);

            services.AddSingleton<RabbitMQClient>();
            services.AddSingleton<RabbitMQServer>();


            return services;
        }
    }
}
